import { reactive } from 'vue'
import { VxeGridProps } from 'vxe-table'

interface Rows {
  copyrightNumber: string
  copyrightName: string
  copyrightPeople: string
  date: string
  authorizationDate: string
  copyrightUnit: string
  submitDate: string
}

const softWorksOptions = reactive<VxeGridProps<Rows>>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    // { title: '序号', type: 'seq', width: 50 },
    { field: 'copyrightCode', title: '版权号' },
    { field: 'softwareName', title: '软件名称' },
    { field: 'owner', title: '专利权人' },
    { field: 'applyDate', title: '申请日期' ,formatter: ['formatDate', 'yyyy-MM-dd'] },
    { field: 'authDate', title: '授权日期' ,formatter: ['formatDate', 'yyyy-MM-dd'] },
    { field: 'completeUnit', title: '完成单位' },
    { field: 'createTime', title: '提交日期' ,formatter: ['formatDate', 'yyyy-MM-dd HH:mm:ss'] },
    { title: '操作', width: 300, slots: { default: 'operate' } },
  ],
  data: [],
})

const softWorksDescriptions = reactive([
  {
    label: '版权号:',
    value: 'copyrightCode',
  },
  {
    label: '软件名称:',
    value: 'softwareName',
  },
  {
    label: '申请日期:',
    value: 'applyDate',
  },
  {
    label: '授权日期:',
    value: 'authDate',
  },
  {
    label: '专利权人:',
    value: 'owner',
  },
  {
    label: '完成单位:',
    value: 'completeUnit',
  },
])

const operationLog = reactive<VxeGridProps>({
  border: true,
  height: 300,
  align: 'center',
  loading: false,
  columnConfig: {
    resizable: true,
  },
  columns: [
    { field: 'type', title: '操作类型', width: 200 },
    { field: 'name', title: '操作员', width: 200 },
    { field: 'content', title: '操作内容' },
    { field: 'date', title: '操作时间', width: 200 },
  ],
  toolbarConfig: {
    slots: {
      buttons: 'toolbar_buttons',
    },
  },
  data: [
    {
      type: '修改状态',
      name: '曲丽丽',
      content: '修改了“软件名称”',
      date: '2023-01-01 00:00:00',
    },
    {
      type: '新增信息',
      name: '周毛毛',
      content: '新增软著信息',
      date: '2023-01-01 00:00:00',
    },
  ],
})

export { softWorksOptions, softWorksDescriptions, operationLog }
